import * as React from 'react';
import Backdrop from '@mui/material/Backdrop';
import CircularProgress from '@mui/material/CircularProgress';
import PropsTypes  from 'prop-types';

export default function Loading(props) {
  const { flag } = props;
  return (
    <div>
      <Backdrop
        invisible={false}
        children={<div>加载中...</div>}
        sx={{ color: '#FFF', zIndex: (theme) => theme.zIndex.drawer + 1 }}
        open={flag}
      >
        <CircularProgress color="inherit" />
      </Backdrop>
    </div>
  )
}

Loading.propTypes = {
  flag: PropsTypes.bool
}
Loading.defaultProps = {
  flag: true
}

